//
//  LBBall.m
//  LittleBall
//
//  Created by apple on 11-11-27.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "LBPropertyUnit.h"

@implementation LBPropertyUnit

@synthesize m_backgroundImageView;
@synthesize m_propertyImageView;
@synthesize m_levelLable;
@synthesize m_numLable;
@synthesize m_buyButton;
@synthesize m_propertyType;
@synthesize m_propertyLevel;
@synthesize m_propertyNum;
@synthesize m_propertyValue;
@synthesize m_centerPoint;


- (id)initWithType:(LB_PROPERTY_TYPE)type Level:(int)level Number:(int)number Value:(int)value
{
    if( !(self = [super init]))
    {
        return nil;
    }
    
    m_propertyType = type;
    m_propertyLevel = level;
    m_propertyNum = number;
    m_propertyValue = value;
    
    return self;
}


- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeInt:m_propertyType forKey:DATA_KEY_NAME_PROPERTYTYPE];
    [encoder encodeInt:m_propertyLevel forKey:DATA_KEY_NAME_PROPERTYLEVEL];
    [encoder encodeInt:m_propertyNum forKey:DATA_KEY_NAME_PROPERTYNUM];
    [encoder encodeInt:m_propertyValue forKey:DATA_KEY_NAME_PROPERTYVALUE];
}


- (id)initWithCoder:(NSCoder *)decoder
{
    if( !(self = [super init]))
    {
        return nil;
    }
    
    m_propertyType = [decoder decodeIntForKey:DATA_KEY_NAME_PROPERTYTYPE];
    m_propertyLevel = [decoder decodeIntForKey:DATA_KEY_NAME_PROPERTYLEVEL];
    m_propertyNum = [decoder decodeIntForKey:DATA_KEY_NAME_PROPERTYNUM];
    m_propertyValue = [decoder decodeIntForKey:DATA_KEY_NAME_PROPERTYVALUE];
    return self;
}

@end